<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org">
<title>Sample test document illustrating the relationship between fixtures and documents</title>
</head>
<body bgcolor="white" lang="EN-US" >
<div class="Section1">
<h2>Sample test document illustrating the relationship between fixtures and documents</h2>
<p class="MsoNormal">This is narrative text explaining what the tests in this document are all about. We can write anything we want here; it's completely ignored by Fit itself.</p>
<table border="1" cellspacing="0" cellpadding="4">
<tr >
<td colspan="4">com.tddinaction.fit.fixtures.CalculatorFixture</td>
</tr>
<tr>
<td>
left
</td>
<td width="104" valign="top" >
right
</td>
<td width="99" valign="top" >
operator
</td>
<td width="95" valign="top" >
result()
</td>
</tr>
<tr >
<td width="95" valign="top" >
5
</td>
<td width="104" valign="top" >
3
</td>
<td width="99" valign="top" >
+
</td>
<td width="95" valign="top" >
8
</td>
</tr>
<tr >
<td width="95" valign="top" >
5
</td>
<td width="104" valign="top" >
3
</td>
<td width="99" valign="top" >
-
</td>
<td width="95" valign="top" >
2
</td>
</tr>
<tr >
<td width="95" valign="top" >
5
</td>
<td width="104" valign="top" >
3
</td>
<td width="99" valign="top" >
*
</td>
<td width="95" valign="top" >
15
</td>
</tr>
<tr >
<td width="95" valign="top" >
5
</td>
<td width="104" valign="top" >
3
</td>
<td width="99" valign="top" >
/
</td>
<td width="95" valign="top" >
1.6666666666666667
</td>
</tr>
</table>
<p class="MsoNormal">The above table is a test interpreted by Fit according to the rules embedded into the header row cell values and the fixture class' inheritance hierarchy.</p>
<p class="MsoNormal">We can also include multiple test tables in a single document. In this case, we've used the same fixture class, but it could just as well be some other fixture.</p>
<table border="1" cellspacing="0" cellpadding="4">
<tr >
<td width="392" colspan="4" valign="top" >
com.tddinaction.fit.fixtures.CalculatorFixture
</td>
</tr>
<tr >
<td width="95" valign="top" >
left
</td>
<td width="104" valign="top" >
right
</td>
<td width="99" valign="top" >
operator
</td>
<td width="95" valign="top" >
result()
</td>
</tr>
<tr >
<td width="95" valign="top" >
5
</td>
<td width="104" valign="top" >
0
</td>
<td width="99" valign="top" >
*
</td>
<td width="95" valign="top" >
0
</td>
</tr>
<tr >
<td width="95" valign="top" >
5
</td>
<td width="104" valign="top" >
0
</td>
<td width="99" valign="top" >
/
</td>
<td width="95" valign="top" >
error
</td>
</tr>
</table>

<p class="MsoNormal">Fit will interpret and execute the tables it finds in a document in the order it encounters them.</p>

<p class="MsoNormal">We can also use RowFixtures to verify that the Calculator is recording a history of operations. This table verifies that the Calculator only remembers the five last operations (remember that we started with "5+3". That shouldn't be part of the rendered history because we've already performed five operations after that one):</p>

<table border="1" cellspacing="0" cellpadding="4">
<tr >
<td width="356" colspan="3" valign="top" >
com.tddinaction.fit.fixtures.CalculatorHistoryFixture
</td>
</tr>
<tr >
<td width="36" valign="top" >
left
</td>
<td width="50" valign="top" >
operator
</td>
<td width="270" valign="top" >
right
</td>
</tr>
<tr >
<td width="36" valign="top" >
5
</td>
<td width="50" valign="top" >
-
</td>
<td width="270" valign="top" >
3
</td>
</tr>

<tr >
<td width="36" valign="top" >
5
</td>
<td width="50" valign="top" >
*
</td>
<td width="270" valign="top" >
3
</td>
</tr>

<tr >
<td width="36" valign="top" >
5
</td>
<td width="50" valign="top" >
/
</td>
<td width="270" valign="top" >
3
</td>
</tr>

<tr >
<td width="36" valign="top" >
5
</td>
<td width="50" valign="top" >
*
</td>
<td width="270" valign="top" >
0
</td>
</tr>
<tr >
<td width="36" valign="top" >
5
</td>
<td width="50" valign="top" >
/
</td>
<td width="270" valign="top" >
0
</td>
</tr>
</table>

<p class="MsoNormal">In order to illustrate the use of the ActionFixture as well, consider the following table:</p>

<table border="1" cellspacing="0" cellpadding="4">
<tr >
<td width="289" colspan="3" valign="top" >
fit.ActionFixture
</td>
</tr>
<tr >
<td width="50" valign="top" >
start
</td>
<td width="239" colspan="2" valign="top" >
com.tddinaction.fit.fixtures.CalculatorActionFixture
</td>
</tr>
<tr >
<td width="50" valign="top" >
check
</td>
<td width="59" valign="top" >
display
</td>
<td width="180" valign="top" >
0
</td>
</tr>
<tr >
<td width="50" valign="top" >
enter
</td>
<td width="59" valign="top" >
input
</td>
<td width="180" valign="top" >
1
</td>
</tr>
<tr >
<td width="50" valign="top" >
check
</td>
<td width="59" valign="top" >
display
</td>
<td width="180" valign="top" >
1
</td>
</tr>
<tr >
<td width="50" valign="top" >
press
</td>
<td width="59" valign="top" >
plus
</td>
<td width="180" valign="top" >
&nbsp;
</td>
</tr>
<tr >
<td width="50" valign="top" >
check
</td>
<td width="59" valign="top" >
display
</td>
<td width="180" valign="top" >
1
</td>
</tr>
<tr >
<td width="50" valign="top" >
enter
</td>
<td width="59" valign="top" >
input
</td>
<td width="180" valign="top" >
3
</td>
</tr>
<tr >
<td width="50" valign="top" >
check
</td>
<td width="59" valign="top" >
display
</td>
<td width="180" valign="top" >
3
</td>
</tr>
<tr >
<td width="50" valign="top" >
press
</td>
<td width="59" valign="top" >
equals
</td>
<td width="180" valign="top" >
&nbsp;
</td>
</tr>
<tr >
<td width="50" valign="top" >
check
</td>
<td width="59" valign="top" >
display
</td>
<td width="180" valign="top" >
4
</td>
</tr>
</table>

<p>That&rsquo;s about it. Not too complex, right?</p>
</div>
</body>
</html>
